﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>七颗牙学堂</title>

    <link href="css/common.css" rel="stylesheet" type="text/css">
    <link href="css/layer.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="js/common.js"></script>

</head>
<style>
    .pic {
        width: 7.2rem;
        height: 12.8rem;
        margin: auto;
        display: none;
    }
    
    .pic img {
        width: 100%;
        height: 100%;
    }
    
    .link {
        text-align: center;
        margin-top: .2rem;
        color: #333;
        font-size: .3rem;
        display: none;
    }
</style>

<body>
    <div class="pic">
        <img src="" />
    </div>
    <div class="link">链接错误</div>


    <script type="text/javascript" src="./js/layer.js"></script>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript">
        $(function() {
            // var request = 'https://n.qikeya.com/ypkj/public/index.php/';
            var request = 'https://api.1pkj.cn/';

            function GetQueryString(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]);
                return null;
            }
            // act_id
            if (GetQueryString("act_id")) {
                var act_id = GetQueryString("act_id");
                var ua = window.navigator.userAgent.toLowerCase();   //判断是不是微信
                if (ua.match(/MicroMessenger/i) == 'micromessenger') {  
                    window.location.href = request + 'api/Login/actLogin?act_id=' + act_id + ''
                } else {
                    $('.link').show();
                    $('.pic').hide();
                    $('.link').html('请在微信中打开');
                    layer.open({
                        content: '请在微信中打开',
                        skin: 'msg',
                        time: 1 //1秒后自动关闭
                    });
                }
            } else if (GetQueryString("r")) {
                var res1 = GetQueryString("r");
                var res = JSON.parse(res1);
                if (Number(res.errcode) == 0) {
                    $('.pic').show();
                    var pic_img = res.data.img_path;
                    $('.pic img').attr('src', 'https://ypkj-saas.oss-cn-zhangjiakou.aliyuncs.com' + pic_img);
                }
            } else {
                $('.link').show();
                $('.pic').hide();
                $('.link').html('链接错误');
                layer.open({
                    content: '链接错误',
                    skin: 'msg',
                    time: 1 //1秒后自动关闭
                });
            }
        })
    </script>
</body>

</html>